﻿namespace Home.Repository
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Data.Entity.ModelConfiguration;
    using System.Linq;
    using System.Web;
    using Home.Data;
    using Home.Models;

    public class UtilityDbContext : EntityFrameworkDbContext
    {
        static UtilityDbContext()
        {
            Database.SetInitializer<UtilityDbContext>(null);
        }

        public UtilityDbContext()
            : base("Name=DefaultConnection", false)
        {
        }

        public DbSet<RequestDescription> Requests { get; set; }

        protected override void OnModelCreating(DbModelBuilder builder)
        {
            {
                var entity = builder.CreateEntity<RequestDescription>("t_request");

                entity.Property(m => m.Date)
                      .HasColumnName("date")
                      .IsRequired();

                entity.Property(m => m.Guid)
                      .HasColumnName("guid")
                      .IsRequired();

                entity.Property(m => m.Type)
                      .HasColumnName("type")
                      .IsRequired();
            }
        }
    }
}